require("./index.scss");

const happy = require("./happy.jpg");
const logo = require('./logo.png');

console.log("Hello Webpack!");

document.body.appendChild(component());

function component(){
    const element = document.createElement('div');

    return createImg(element, [happy, logo])
}

function createImg(image, urls) {
    if (Object.prototype.toString.call(urls) !== '[object Array]') {
        urls = [urls]
    }
    urls.forEach(url => {
        const img = new Image();
        img.src = url;
        image.appendChild(img)
    })

    return image;
}
